/**
 * Created by chenqiailai on 17/9/10.
 */
$(function () {
    //性别
    // alert(result[45]);
    // alert(result.strat);

    //treeanimate
    function treeanimate(treeindex) {
        var tree = $('.tree');
        switch(treeindex){
            case 0 :
                $(tree).animate({top:'-2rem'});
                break;
            case 1 :
                $(tree).animate({top:'-2.8rem'});
                break;
            case 2 :
                $(tree).animate({top:'-2.6rem'});
                break;
            case 3 :
                $(tree).animate({top:'-2.4rem'});
                break;
            case 4 :
                $(tree).animate({top:'-2.2rem'});
                break;
            case 5 :
                $(tree).animate({top:'-2.0rem'});
                break;
            case 6 :
                $(tree).animate({top:'-2.8rem'});
                break;
            default:
                break;
        }
    };


    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        slidesPerView: 1,
        paginationClickable: true,
        //                spaceBetween: 30,
        loop: true,
        onSlideChangeStart: function(swiper){
            // alert(swiper.activeIndex);
            treeanimate(swiper.activeIndex);
        }

    });


    $('.step-a').click(function () {
        var ageChoice = $('.swiper-slide-active').attr('data-swiper-slide-index');
        switch(ageChoice)
        {
            case '0':
                result[46] = '41-50';
                break;
            case '1':
                result[46] = '31-40';

                break;
            case '2':
                result[46]= '26-30';

                break;
            case '3':
                result[46] = '18-25';

                break;
            case '4':
                result[46] = '18岁以下';

                break;
            default:

        };

    });


});


